package com.kaifamiao.dispatch;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.logging.Logger;

@WebServlet( "/user/sign/up" )
public class UserSignUpServlet extends HttpServlet {

    private Logger logger = Logger.getLogger( this.getClass().getName() );

    @Override
    protected void service( HttpServletRequest request , HttpServletResponse response )
            throws ServletException, IOException {
        logger.info( "接受到用户注册请求" );

        // 接受来自表单的数据
        String uname = request.getParameter( "username" );
        String passwd = request.getParameter( "password" );
        String conf = request.getParameter( "confirm" );

        logger.info( "注册表单中的参数值: " + uname + " , " + passwd + " , " + conf );

        logger.info( "浏览器即将打开登录页面" );
        response.sendRedirect( "/sign-in.html" );

    }
}
